package com.sc;

import javax.imageio.ImageIO;
import java.awt.*;
import java.awt.image.BufferedImage;
import java.io.*;

/**
 * @Author sc
 * @ClassName image
 * @Description class function:
 * @Date 2023/10/20 19:08:54
 **/
public class image {
    public static void main(String[] args) {
        //诚成一张800x000的图片
        BufferedImage bufferedImage = new BufferedImage(800, 800, BufferedImage.TYPE_INT_RGB);
        //使用ImageIO生成背景色为白色的图
        bufferedImage.createGraphics().setBackground(Color.WHITE);
        Graphics2D graphics = bufferedImage.createGraphics();
        graphics.drawString("你好坏",50,50);
        graphics.dispose();
        try {
            ImageIO.write(bufferedImage,"jpg",new File("D:\\1.jpg"));
        } catch (IOException e) {
            throw new RuntimeException(e);
        }
    }
}
